<?
require_once 'config.php';
$bg_errorMsg = '';
$bg_success = '';
$action = getValue('action','str','POST','');
if($action == 'execute'){
    $name_field = getValue('name','str','POST','',2);
    $email_field = getValue('email','str','POST','',2);
    if(!filter_var($email_field, FILTER_VALIDATE_EMAIL)){
        $bg_errorMsg .= 'Email không đúng định dạng <br>';
    }
    $title_field = getValue('title','str','POST','',2);
    $content_field = getValue('content','str','POST','',2);
    $con_date = time();
    $myform = new generate_form();
    $myform->add('con_name','name_field',0,1,'',1,'Bạn chưa nhập tên');
    $myform->add('con_email','email_field',0,1,'',1,'Bạn chưa nhập email');
    $myform->add('con_subject','title_field',0,1,'',1,'Bạn chưa nhập tiêu đề');
    $myform->add('con_detail','content_field',0,1,'',1,'Bạn chưa nhập nội dung');
    $myform->add('con_date','con_date',1,1,0);
    $myform->addTable('contact');
    $bg_errorMsg .= $myform->checkdata();
    if($bg_errorMsg == ''){
        $db = new db_execute($myform->generate_insert_SQL());
        $bg_success = 1;
    }
    
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="vi" lang="vi" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link type="image/x-icon" href="/favicon.ico" rel="icon" />
    <?
    $db_query = new db_query('SELECT * FROM configuration 
                              WHERE con_type = "seo" LIMIT 1');
    $seo_array = mysql_fetch_assoc($db_query->result);
    $seo_config = json_decode(base64_decode($seo_array['con_value']),true);
    ?>
    <title><?=$seo_config['title_site']?></title>
    <meta name="description" content="<?=$seo_config['meta_description']?>"/>
    <meta name="keywords" content="<?=$seo_config['meta_keyword']?>"/>
    <meta name="AUTHOR" content="Massseo.vn" />
    <meta name="COPYRIGHT" content="Copyright (C) 2013 Massseo.vn" />
    <meta name="ROBOTS" content="INDEX, FOLLOW" />
    <meta name="RATING" content="GENERAL" />
    
    <meta property="og:title" content="Liên hệ Masseo.vn" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="http://massseo.vn/lien-he.html" />
    <meta property="og:image" content="http://massseo.vn/themes/img/logo.png" />
    <meta property="og:site_name" content="MassSeo" />
    <meta property="og:description" content="<?=$seo_config['meta_description']?>" />
    <meta property="fb:admins" content="100004609203263" />
    <meta property="fb:app_id" content="447585838689244"/>
     
    <link rel="stylesheet" type="text/css" href="../themes/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../themes/css/contact.css"/>
    
    <script type="text/javascript" src="../themes/js/jquery.js"></script>
    <?=$analytics?>
    
    <!-- We only want the thunbnails to display when javascript is disabled -->
    <script type="text/javascript">
      document.write('<style>.noscript { display: none; }</style>');
    </script>   
</head>
<body>
   <div class="globalContainer">
      <?
         include('view/common/vic_header.php');
         include('view/common/vic_contact.php');
         include('view/common/vic_footer.php');
      ?>
   </div>
</body>
</html>
<script type="text/javascript">
</script>